package com.lxmes.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lxmes.common.annotation.Log;
import com.lxmes.common.core.controller.BaseController;
import com.lxmes.common.core.domain.AjaxResult;
import com.lxmes.common.enums.BusinessType;
import com.lxmes.business.domain.CcChukuSprw;
import com.lxmes.business.service.ICcChukuSprwService;
import com.lxmes.common.utils.poi.ExcelUtil;
import com.lxmes.common.core.page.TableDataInfo;

/**
 * 出库待办任务Controller
 * 
 * @author ruoyi
 * @date 2023-03-26
 */
@RestController
@RequestMapping("/business/chukuSprw")
public class CcChukuSprwController extends BaseController
{
    @Autowired
    private ICcChukuSprwService ccChukuSprwService;

    /**
     * 查询出库待办任务列表
     */
    @PreAuthorize("@ss.hasPermi('business:chukuSprw:list')")
    @GetMapping("/list")
    public TableDataInfo list(CcChukuSprw ccChukuSprw)
    {
        startPage();
        List<CcChukuSprw> list = ccChukuSprwService.selectCcChukuSprwList(ccChukuSprw);
        return getDataTable(list);
    }

    /**
     * 导出出库待办任务列表
     */
    @PreAuthorize("@ss.hasPermi('business:chukuSprw:export')")
    @Log(title = "出库待办任务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CcChukuSprw ccChukuSprw)
    {
        List<CcChukuSprw> list = ccChukuSprwService.selectCcChukuSprwList(ccChukuSprw);
        ExcelUtil<CcChukuSprw> util = new ExcelUtil<CcChukuSprw>(CcChukuSprw.class);
        util.exportExcel(response, list, "出库待办任务数据");
    }

    /**
     * 获取出库待办任务详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:chukuSprw:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(ccChukuSprwService.selectCcChukuSprwById(id));
    }

    /**
     * 新增出库待办任务
     */
    @PreAuthorize("@ss.hasPermi('business:chukuSprw:add')")
    @Log(title = "出库待办任务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CcChukuSprw ccChukuSprw)
    {
        return toAjax(ccChukuSprwService.insertCcChukuSprw(ccChukuSprw));
    }

    /**
     * 修改出库待办任务
     */
    @PreAuthorize("@ss.hasPermi('business:chukuSprw:edit')")
    @Log(title = "出库待办任务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CcChukuSprw ccChukuSprw)
    {
        return toAjax(ccChukuSprwService.updateCcChukuSprw(ccChukuSprw));
    }
    /**
     * 审批出库待办任务
     */
    @PreAuthorize("@ss.hasPermi('business:chukuSprw:sp')")
    @Log(title = "审批出库待办任务", businessType = BusinessType.UPDATE)
    @PutMapping("/sp")
    public AjaxResult sp(@RequestBody CcChukuSprw ccChukuSprw)
    {
        return toAjax(ccChukuSprwService.spCcChukuSprw(ccChukuSprw));
    }


    /**
     * 删除出库待办任务
     */
    @PreAuthorize("@ss.hasPermi('business:chukuSprw:remove')")
    @Log(title = "出库待办任务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ccChukuSprwService.deleteCcChukuSprwByIds(ids));
    }
}
